/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaz;

import java.io.Serializable;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import negocio.ui.uiClinica;

/**
 *
 * @author David
 */
public class mainFrame extends javax.swing.JFrame implements Serializable {

    /**
     * Creates new form mainFrame
     */
    uiClinica ui = uiClinica.getInstance();
    public mainFrame() {        
        initComponents();
        ui.iniciar();
        setLocationRelativeTo(this);
        this.pack();   
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        MainPanel = new javax.swing.JPanel();
        mainPanel_titulo = new javax.swing.JLabel();
        btn_clientes_mainF = new javax.swing.JButton();
        sep_mainF = new javax.swing.JSeparator();
        btn_expediente_mainF = new javax.swing.JButton();
        btn_agregar_expediete = new javax.swing.JButton();
        jButtonOdontograma = new javax.swing.JButton();
        btn_expdiente_express = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        MainMenuBar = new javax.swing.JMenuBar();
        Archivo_menu = new javax.swing.JMenu();
        Archivo_salir_menu = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema Integrado de Recursos Odontologicos");
        setPreferredSize(new java.awt.Dimension(600, 180));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        MainPanel.setBackground(new java.awt.Color(255, 255, 255));
        MainPanel.setFocusable(false);
        MainPanel.setMinimumSize(new java.awt.Dimension(600, 300));
        MainPanel.setName("MainPanel");
        MainPanel.setPreferredSize(new java.awt.Dimension(600, 300));

        mainPanel_titulo.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        mainPanel_titulo.setText("Clinica - Administrador Clientes");

        btn_clientes_mainF.setText("Clientes");
        btn_clientes_mainF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_clientes_mainFActionPerformed(evt);
            }
        });

        btn_expediente_mainF.setText("Expediente");
        btn_expediente_mainF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_expediente_mainFActionPerformed(evt);
            }
        });

        btn_agregar_expediete.setText("Agregar Expediente");
        btn_agregar_expediete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_agregar_expedieteActionPerformed(evt);
            }
        });

        jButtonOdontograma.setText("Odontograma");
        jButtonOdontograma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonOdontogramaActionPerformed(evt);
            }
        });

        btn_expdiente_express.setText("Expediente Express");
        btn_expdiente_express.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_expdiente_expressActionPerformed(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/2455593_3002.jpg"))); // NOI18N
        jLabel1.setMaximumSize(new java.awt.Dimension(30, 30));
        jLabel1.setMinimumSize(new java.awt.Dimension(30, 30));

        javax.swing.GroupLayout MainPanelLayout = new javax.swing.GroupLayout(MainPanel);
        MainPanel.setLayout(MainPanelLayout);
        MainPanelLayout.setHorizontalGroup(
            MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MainPanelLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(btn_clientes_mainF, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_expediente_mainF, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btn_expdiente_express, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_agregar_expediete)
                    .addComponent(jButtonOdontograma, javax.swing.GroupLayout.Alignment.TRAILING)))
            .addGroup(MainPanelLayout.createSequentialGroup()
                .addGroup(MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MainPanelLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(sep_mainF, javax.swing.GroupLayout.PREFERRED_SIZE, 1004, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(MainPanelLayout.createSequentialGroup()
                        .addGap(72, 72, 72)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(mainPanel_titulo, javax.swing.GroupLayout.PREFERRED_SIZE, 404, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, Short.MAX_VALUE))
        );
        MainPanelLayout.setVerticalGroup(
            MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MainPanelLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mainPanel_titulo)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addComponent(sep_mainF, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addGroup(MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MainPanelLayout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(btn_agregar_expediete)
                        .addGap(18, 18, 18)
                        .addComponent(jButtonOdontograma))
                    .addGroup(MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btn_clientes_mainF, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btn_expediente_mainF, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btn_expdiente_express, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        Archivo_menu.setText("Archivo");

        Archivo_salir_menu.setText("Cerrar");
        Archivo_salir_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Archivo_salir_menuActionPerformed(evt);
            }
        });
        Archivo_menu.add(Archivo_salir_menu);

        MainMenuBar.add(Archivo_menu);

        setJMenuBar(MainMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(MainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(MainPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void Archivo_salir_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Archivo_salir_menuActionPerformed
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?", "", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION){
            System.exit(0);
        }
    }//GEN-LAST:event_Archivo_salir_menuActionPerformed

    private void btn_clientes_mainFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_clientes_mainFActionPerformed
        ui.getClienteF().setVisible(true);
    }//GEN-LAST:event_btn_clientes_mainFActionPerformed

    private void btn_agregar_expedieteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_agregar_expedieteActionPerformed
        ui.getNuevo_expediente_express().setVisible(true);
    }//GEN-LAST:event_btn_agregar_expedieteActionPerformed

    private void btn_expediente_mainFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_expediente_mainFActionPerformed
       ui.getExpedienteF().setVisible(true);
    }//GEN-LAST:event_btn_expediente_mainFActionPerformed

    private void jButtonOdontogramaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOdontogramaActionPerformed
        //ui.getOdonto().setVisible(true);
    }//GEN-LAST:event_jButtonOdontogramaActionPerformed

    private void btn_expdiente_expressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_expdiente_expressActionPerformed
        ui.getNuevo_expediente_express().setVisible(true);
    }//GEN-LAST:event_btn_expdiente_expressActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?", "", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION){
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    }//GEN-LAST:event_formWindowClosing

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(mainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new mainFrame().setVisible(true);
            }
        });
    }

    private JPanel getMainPanel() {
        return MainPanel;
    }
    
    
    
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu Archivo_menu;
    private javax.swing.JMenuItem Archivo_salir_menu;
    private javax.swing.JMenuBar MainMenuBar;
    private javax.swing.JPanel MainPanel;
    private javax.swing.JButton btn_agregar_expediete;
    private javax.swing.JButton btn_clientes_mainF;
    private javax.swing.JButton btn_expdiente_express;
    private javax.swing.JButton btn_expediente_mainF;
    private javax.swing.JButton jButtonOdontograma;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel mainPanel_titulo;
    private javax.swing.JSeparator sep_mainF;
    // End of variables declaration//GEN-END:variables
}
